<?php
class Login extends CI_Controller{

	function index(){
		$this->load->view('login_view');
	}
	
	function validate_credentials(){
		$this->load->model('account_model');
		
		$q = $this->account_model->validate();
		
		if($q){
			$data = array(
				'username' => $this->input->post('username'),
				'is_logged_in' => true
			);
			$this->session->set_userdata($data);
			redirect('blogadmin/');
			
		}
		else{
		
			$this->index();
		}
	
	}
	
	function logout(){
		$this->session->sess_destroy();
		redirect('login');
	}
	



}